<template>
  <div class="app-container">
    <div class="handle-content">
      <el-input v-if="this.$store.getters.role.store_id == 0" v-model="storeId" placeholder="请输入店铺id" style="width: 200px;margin-right: 10px;">
        <el-button slot="append" @click="search">查询</el-button>
      </el-input>
    </div>

    <el-skeleton style="width: 240px" :loading="listLoading" animated>
          <template slot="template">
              <div style="padding: 14px;">
                <el-skeleton-item variant="h3" style="width: 50%;" />
                <div
                  style="display: flex; align-items: center; justify-items: space-between; margin-top: 16px; height: 16px;"
                >
                  <el-skeleton-item variant="text" style="margin-right: 16px;" />
                  <el-skeleton-item variant="text" style="width: 30%;" />
                </div>
              </div>
            </template>
          <template>
            <el-card :body-style="{ padding: '0px', marginBottom: '1px' }">
              <div style="padding: 14px;">
                <div style="line-height: 23px;margin-top: 5px;">订单数目:{{count}}</div>
                <div style="line-height: 23px;margin-top: 5px;">订单总金额:{{ price }}</div>
                <div style="line-height: 23px;margin-top: 5px;">订单支付总金额:{{ pay_price }}</div>
                <div style="line-height: 23px;margin-top: 5px;">订单积分抵扣总金额:{{ jf_price }}</div>
              </div>
            </el-card>
          </template>
        </el-skeleton>

    <el-table v-loading="listLoading" :data="list" element-loading-text="拼命加载中" border fit highlight-current-row>
      <el-table-column v-if="this.$store.getters.role.store_id == 0" label="店铺ID" align="center">
        <template slot-scope="scope">
          {{ scope.row.store_id }}
        </template>
      </el-table-column>
      <el-table-column v-if="this.$store.getters.role.store_id == 0" label="店铺名称" align="center">
        <template slot-scope="scope">
          {{ scope.row.store_title }}
        </template>
      </el-table-column>
      <el-table-column label="订单ID" align="center">
        <template slot-scope="scope">
          {{ scope.row.order_id }}
        </template>
      </el-table-column>
      <el-table-column label="下单人ID" align="center">
        <template slot-scope="scope">
          {{ scope.row.user_id }}
        </template>
      </el-table-column>
      <el-table-column label="订单类型" align="center">
        <template slot-scope="scope">
          {{ scope.row.type_cn }}
        </template>
      </el-table-column>
      <el-table-column label="订单金额" align="center">
        <template slot-scope="scope">
          {{ scope.row.price }}
        </template>
      </el-table-column>
      <el-table-column label="支付金额" align="center">
        <template slot-scope="scope">
          {{ scope.row.pay_price }}
        </template>
      </el-table-column>
      <el-table-column label="支付积分" align="center">
        <template slot-scope="scope">
          {{ scope.row.jf_price }}
        </template>
      </el-table-column>
      <el-table-column label="偏差" align="center">
        <template slot-scope="scope">
          {{ scope.row.price - scope.row.pay_price - scope.row.jf_price}}
        </template>
      </el-table-column>
      <el-table-column label="支付时间" align="center">
        <template slot-scope="scope">
          {{ scope.row.pay_at }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { reviewOrderGold } from '@/api/order'

export default {

  data() {
    return {
      showOrderInfo: false,
      list: [],
      listLoading: false,
      listQuery: {
        page: 1,
        storeId: 0,
        pageSize: 10
      },
      storeId:'',
      conut:'',
      price:'',
      pay_price:'',
      jf_price:''
    }
  },
  mounted() {
    this.getList()
  },

  methods: {
    getList() {
      this.listLoading = true
      reviewOrderGold(this.listQuery).then(response => {
        this.list = response.data.data
        this.count = response.data.count
        this.price = response.data.price
        this.pay_price = response.data.pay_price
        this.jf_price = response.data.jf_price
        this.listLoading = false
      })
    },
    search() {
      this.listQuery.storeId = this.storeId
      this.getList()
    }
  }

}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.app-container{
    .handle-content{
        margin: 1.5rem;
        .right{
            float: right;
            margin-bottom: 20px;
        }
    }
}
</style>
